<template>
  <div class="tag">
    <el-tag
      v-for="(tag, index) in tags"
      :key="tag.name"
      :closable="tag.name !== 'home'"
      :effect="$router.name === tag.name ? 'dark' : 'plain'"
      @click="changeMenu(tag)"
      @close="closeMenu(tag.label, index)"
      size="small">
      {{ tag.label }}
    </el-tag>
  </div>
</template>

<script>
import { mapState } from "vuex";
export default {
  data() {
    return {};
  },
  computed: {
    ...mapState({
      tags: (state) => state.tab.menuList,
    }),
  },
  methods: {
    changeMenu(item) {
      this.$router.push(item.name);
    },
    closeMenu(tag, index) {},
  },
};
</script>

<style scoped>
.el-tag {
  margin-right: 10px;
}
</style>
